/******************************************************************************
* SVN­Version­Information:
* ­­­­­­­­­­­­­­­­­­­­­­­­---------------------
* $LastChangedRevision: 6 $
* $LastChangedBy: c.a.duevel $
* $LastChangedDate: 2009-08-26 15:12:37 +0000 (Wed, 26 Aug 2009) $
* $HeadURL: http://robofight.googlecode.com/svn/trunk/ClientJavaFX/src/de/hft_stuttgart/robofight/client/javafx/util/ScrollButton.fx $
******************************************************************************/
package de.hft_stuttgart.robofight.client.javafx.util;

import javafx.scene.CustomNode;
import javafx.scene.effect.DropShadow;
import javafx.scene.effect.Effect;
import javafx.scene.effect.Glow;
import javafx.scene.Group;
import javafx.scene.input.MouseEvent;
import javafx.scene.Node;
import javafx.scene.paint.Color;
import javafx.scene.shape.Polygon;

/**
 * @author ralf.dauenhauer@gmx.de
 */

public class ScrollButton extends CustomNode {

    public var x: Number;
    public var y: Number;
    public var h: Number;
    public var arrow: Polygon;
    public var action:function():Void;
    public var scrolling = true;
    var mouseEffect: Effect;

    override public function create():Node {
        Group {
            translateX: x
            translateY: y
//            effect: bind mouseEffect
//            effect: DropShadow {
//				offsetX: 0
//				offsetY: 0
//				color: Color.rgb(255, 255, 255, 0.75)
//				radius: 4
//				spread: 0.25
//			}
//            onMouseEntered: function(e:MouseEvent) {
//                if (scrolling) {
//                    mouseEffect = Glow {
//                        level: 1.0
//                    }
//                }
//            }
//            onMouseExited: function(e:MouseEvent) {
//                mouseEffect = null;
//            }
            onMousePressed: function(e:MouseEvent) {
                if (scrolling) {
                    arrow.fill = Color.DARKGRAY;
                    action();
                }
            }
            onMouseReleased: function(e:MouseEvent) {
                arrow.fill = Color.rgb(23, 185, 241);
            }
            content: arrow
        }
    }

}

